package o;

import com.huawei.appgallery.foundation.store.bean.detail.DetailResponse;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse.LayoutData;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import com.huawei.appmarket.service.store.awk.bean.HorizontalVideoStreamCardBean;
import com.huawei.appmarket.service.store.awk.bean.VideoStreamListCardBean;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;

public class emp implements emo {
    private static final Object ˏ = new byte[0];
    private static emp ॱ = null;
    private boolean ʽ = true;
    public Map<Long, List<VideoStreamListCardBean>> ˊ = new LinkedHashMap();
    public Map<Long, Integer> ˋ = new LinkedHashMap();
    private List<VideoStreamListCardBean> ˎ = new ArrayList();

    public static emp ˎ() {
        emp o_emp;
        synchronized (ˏ) {
            if (ॱ == null) {
                ॱ = new emp();
            }
            o_emp = ॱ;
        }
        return o_emp;
    }

    public void ˎ(clm o_clm, final c cVar) {
        cfw.ˎ(o_clm, new IServerCallBack(this) {
            final /* synthetic */ emp ˊ;

            public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
            }

            public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
                if ((responseBean instanceof DetailResponse) && responseBean.getResponseCode() == 0) {
                    DetailResponse detailResponse = (DetailResponse) responseBean;
                    if (detailResponse.getRtnCode_() == 0) {
                        this.ˊ.ˎ(detailResponse);
                        if (cVar != null) {
                            if (CollectCheck.isEmpty(this.ˊ.ˎ)) {
                                cVar.ˊ(this.ˊ.ʽ);
                                return;
                            } else {
                                cVar.ॱ(this.ˊ.ˎ, this.ˊ.ʽ, ((clm) o_cvu).ॱ() + 1);
                                return;
                            }
                        }
                    }
                }
                if (cVar != null) {
                    cVar.ˊ(this.ˊ.ʽ);
                }
            }
        });
    }

    public void ˎ(boolean z) {
        this.ʽ = z;
    }

    private void ˎ(DetailResponse<CardBean> detailResponse) {
        if (detailResponse != null) {
            if (detailResponse.ॱ() == 0) {
                ˎ(false);
            } else {
                ˎ(true);
            }
            List ᐝॱ = detailResponse.ᐝॱ();
            if (!CollectCheck.isEmpty(ᐝॱ)) {
                LayoutData layoutData = (LayoutData) ᐝॱ.get(0);
                if (layoutData != null && !CollectCheck.isEmpty(layoutData.ˋ())) {
                    if (layoutData.ˋ().get(0) instanceof HorizontalVideoStreamCardBean) {
                        HorizontalVideoStreamCardBean horizontalVideoStreamCardBean = (HorizontalVideoStreamCardBean) layoutData.ˋ().get(0);
                        if (!CollectCheck.isEmpty(horizontalVideoStreamCardBean.ʼᐝ())) {
                            this.ˎ = horizontalVideoStreamCardBean.ʼᐝ();
                        } else {
                            return;
                        }
                    }
                    this.ˎ = emt.ॱ(layoutData.ˋ());
                    ॱ(layoutData);
                }
            }
        }
    }

    private void ॱ(LayoutData<CardBean> layoutData) {
        int i = 0;
        if (layoutData.ˊ() == 1) {
            i = 1;
        }
        if (layoutData.ॱ() == 1) {
            i |= 2;
        }
        ˊ(i);
    }

    private void ˊ(int i) {
        if (!CollectCheck.isEmpty(this.ˎ)) {
            ListIterator listIterator = this.ˎ.listIterator(0);
            while (listIterator.hasNext() && this.ˎ.size() > 1) {
                if (((VideoStreamListCardBean) listIterator.next()).ˋ(i)) {
                    listIterator.remove();
                }
            }
        }
    }
}
